import React from 'react'
import { Navigate } from 'react-router-dom'


type TProtectedRoute = {
  element: any
  isLoggedIn: boolean
}

function ProtectedRoute({ element: Component, isLoggedIn, ...props }: any) {
  return (
    <>{isLoggedIn ? <Component {...props} /> : <Navigate to='/' replace />}</>
  )
}

export default ProtectedRoute
